package clientUtilGUI;

import java.awt.Color;
import java.awt.Component;
import java.awt.Font;

import javax.swing.JButton;
import javax.swing.JTable;
import javax.swing.UIManager;
import javax.swing.table.TableCellRenderer;

public class ButtonRenderer extends JButton implements TableCellRenderer {

	  public ButtonRenderer() {
	    setOpaque(true);
//	    setHorizontalAlignment(CENTER);
	    setHorizontalTextPosition(CENTER);
	    setVerticalTextPosition(CENTER);
	    setVerticalAlignment(CENTER);
	  }

	  public Component getTableCellRendererComponent(JTable table, Object value,
	      boolean isSelected, boolean hasFocus, int row, int column) {
		setFont(new Font("Tahoma", Font.BOLD, 13));
	    if (isSelected) {
	      setForeground(Color.BLACK);
	      setBackground(table.getSelectionBackground());
	    } else {
	      setForeground(table.getForeground());
	      setBackground(UIManager.getColor("Button.background"));
	    }
	    setText((value == null) ? "" : value.toString());
	    return this;
	  }
}
